#pragma once
#ifndef AndroiPicker_h__
#define AndroiPicker_h__

#include <QObject>
#include <QAndroidActivityResultReceiver>
#include "../AbstractImagePicker.h"

namespace TC
{
    class AndroidPicker : public QObject, public QAndroidActivityResultReceiver
    {
        Q_OBJECT

        Q_PROPERTY(QUrl fileUrl READ fileUrl NOTIFY fileUrlChanged)
    public:
        AndroidPicker(QString contentType, QObject *parent = nullptr);
    signals:
        void fileUrlChanged();
        void accepted();
        void rejected();
        void error();
    public:
        QUrl fileUrl();
    public slots:
        void open();
    private:
        QUrl _fileUrl;
        QString contentType;
        virtual void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject & data);
    };
}
#endif // AndroiPicker_h__
